package fun.tan90.easy.binlog.manager.model.cmd;

import cn.hutool.core.util.RandomUtil;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 实体类。
 *
 * @author 陈浩杰
 * @since 2023-09-01
 */
@Data
public class BinlogMasterAddCmd {

    /**
     * slave客户端名称
     */
    @NotNull
    @NotBlank
    private String masterName;

    /**
     * master 地址
     */
    @NotNull
    @NotBlank
    private String hostname;

    /**
     * master 端口
     */
    @NotNull
    private Integer port;

    /**
     * 用户名
     */
    @NotNull
    @NotBlank
    private String username;

    /**
     * 密码
     */
    @NotNull
    @NotBlank
    private String password;

    /**
     * 是否keepalive
     */
    private String keepAlive = "1";

    /**
     * keepalive时间间隔 ms
     */
    private Integer keepAliveInterval = 60000;

    /**
     * 心跳时间间隔 ms
     */
    private Integer heartbeatInterval = 6000;

    /**
     * 连接超时时间 ms
     */
    private Integer connectTimeout = 3000;

    /**
     * 服务ID
     */
    private Integer serverId = RandomUtil.randomInt(1000, 10000);

    /**
     * 时间偏移量
     */
    private Integer offsetMilliseconds = -28800000;
}
